package com.yswy.app.controller;

import com.yswy.app.service.PackageManageService;
import com.yswy.common.model.ResultModel;
import com.yswy.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

import static com.yswy.domain.common.util.TokenUtils.getChannle;
import static com.yswy.domain.common.util.TokenUtils.getUserId;

@RestController
@RequestMapping("/packge")
@Api(description = "更新")
public class PackgeController {
    @Autowired
    private PackageManageService packageManageService;
    @RequestMapping(value = "getForcePackage", method = RequestMethod.GET)
    @ApiOperation(value = "获取更新包")
    public ResultModel getForcePackage(@RequestParam(value = "channle" , required = false) String channle
                                       ,HttpServletRequest request ){
        if (StringUtils.isEmpty(channle)){
            channle = getChannle(request);
        }
        return ResultModel.ok(packageManageService.gePackageManage(channle));
    }


}
